import { defineComponent, PropType } from "vue";
import "./index.scss";
import { TableItem } from "@/types/index";
export default defineComponent({
    props: {
        // 接收父组件传递的数据
        data: {
            type: Array as PropType<TableItem[]>,
            required: true,
            default: () => []
        }
    },
    setup(props) {
        return () => (
            <div style={{width: "100%",height: "110%"}}>
                <table >
                    <thead>
                        <tr>
                            <th class="text-xl">名称</th>
                            <th class="text-xl">规格</th>
                            <th class="text-xl">单位</th>
                            <th class="text-xl">单价</th>
                        </tr>
                    </thead>
                    <tbody>
                    {/* 动态渲染表格行 */}
                    {props.data.map((item) => (
                        <tr>
                            <td>{item.YYXMMC}</td>
                            <td>{item.YYXMGG}</td>
                            <td>{item.YYKFDWMC}</td>
                            <td>{item.XMDJ}</td>
                        </tr>
                    ))}
                    </tbody>
                </table>
            </div>
        );
    }
})
